<%-- 
    Document   : newEvaluation
    Created on : 16/11/2011, 08:40:45
    Author     : great
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<link rel="stylesheet" href="../css/evaluation.css" type="text/css" />

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>

        <script>
            var iLevel = 0;
            var levels = new Array();
            
            function enableSystem(){
                var system = document.getElementById("system");
                system.style.display = 'block';
                
                
            }
            
            function enableMetric(){
                var metric = document.getElementById("metric");
                metric.style.display = 'block';
                
                
            }
            
            function enableParameters(){
                var parameters = document.getElementById("parameters");
                parameters.style.display = 'block';
                
                
            }
            
            function enableFactors(){
                var factors = document.getElementById("factors");
                factors.style.display = 'block';
            }
            

            function activeLevels(){
                var levelForm = document.getElementById("levels");
                levelForm.style.display = 'block';
                var factors = document.getElementById("submitFactors");
                factors.style.display = 'block';
            }
            
            
            function addFactorsAndLevels()
            {
                alert('entrou addfactorsandlevels');
                var levelLabels = new Array();
                var data = "";
                
                for(var j=0; j<5; j++){
                    levelLabels[j] = (document.getElementById("levelDescription"+j));                    
                }
                
                for(var j=0; j<5; j++){
                    if(levelLabels[j].value != ""){
                        levels[j] = levelLabels[j].value;
                    }
                }
                
                for(var i=0; i<levels.length; i++)
                {
                    data += "level" + i + "=" + levels[i];
                }
                alert(data);
                url = "addFactors"
                
                var myAjax = new Ajax.Request(url,
                {            
                    method: 'get',
                    parameters: data,
                    onComplete: alert('completou ajax')
                }
            );
            } 
            
            
        </script>


    </head>
    <body>
        <h1>New Evaluation</h1>

        <h3> Esta Avaliação segue a abordagem sistemática proposta por RAG JAN. </h3>

        <table border="2" cellSPACING="20" align="vertical" >

            <tr> 
                <td><a href="javascript:enableSystem();"</a>Goals and System</td>
            </tr>
            <tr> 
                <td><a href=""</a>Services</td>
            </tr>
            <tr> 
                <td><a href="javascript:enableMetric();"</a>Metrics</td>
            </tr>
            <tr> 
                <td><a href="javascript:enableParameters();"</a>Parameters</td>
            </tr>
            <tr> 
                <td><a href="javascript:enableFactors();"</a>Factores</td>
            </tr>
            <tr> 
                <td><a href=""</a>Workload</td>
            </tr>
            <tr> 
                <td><a href=""</a>Design Experimental</td>
            </tr>
            <tr> 
                <td><a href=""</a>Analysis and Interpretation</td>
            </tr>
            <tr> 
                <td><a href=""</a>Results Presentation</td>

        </table>

        <form name="system" id="system" action="addSystem" method="post" hidden="true"   >
            <fieldset>
                <legend> Goals and Systens </legend>
                <label >System Name: </label>
                <input id="sysName" type="text" name="system.name" /> <br />

                <label for="pass">System Description: </label>
                <input id="sysDescription" type="text" name="system.description" /> <br />


                <button id="btSubmit" type="submit"  >Save</button> <br />

                <%--                <c:forEach var="error" items="${errors}">   
                                    <li>${error.message}</li>   
                                </c:forEach>  
                --%>

            </fieldset>
        </form>

        <form name="metric" id="metric" action="addMetric" method="post" hidden="true"   >
            <fieldset>
                <legend> Metrics </legend>
                <label >Metric Name: </label>
                <input id="metricName" type="text" name="metric.name" /> <br />

                <label for="pass">Metric Description: </label>
                <input id="metricDescription" type="text" name="metric.description" /> <br />


                <button id="btSubmit" type="submit"  >Save</button> <br />

                <%--                <c:forEach var="error" items="${errors}">   
                                    <li>${error.message}</li>   
                                </c:forEach>  
                --%>

            </fieldset>
        </form>

        <form name="parameters" id="parameters" action="addParameters" method="post" hidden="true"   >
            <fieldset>
                <legend> Parameters </legend>
                <label >Parameter Name: </label>
                <input id="parametersName" type="text" name="parameters.name" /> <br />

                <label for="pass">Parameter Value: </label>
                <input id="parametersValue" type="text" name="parameters.value" /> <br />

                <label for="pass">Parameter Type: </label>
                <input id="parametersType" type="text" name="parameters.parametertype" /> <br />

                <button id="btSubmit" type="submit"  >Save</button> <br />

                <%--                <c:forEach var="error" items="${errors}">   
                                    <li>${error.message}</li>   
                                </c:forEach>  
                --%>

            </fieldset>
        </form>

        <form name="factors" id="factors" action="addFactors" method="post" hidden="true"   >
            <fieldset>
                <legend> Factors </legend>
                <label >Factor Name: </label>
                <input id="factorsName" type="text" name="factors.name" /> <br />

                <label for="pass">Factor Type: </label>
                <input id="parametersValue" type="text" name="factors.parameterType" /> <br />

                <label >Level 1: </label>
                <input id="levelDescription1" type="text"  name="level1.description"/> <br />

                <label >Level 2: </label>
                <input id="levelDescription2" type="text"  name="level2.description"/> <br />

                <label >Level 3: </label>
                <input id="levelDescription3" type="text"  name="level3.description"/> <br />

                <label >Level 4: </label>
                <input id="levelDescription4" type="text"  name="level4.description"/> <br />

                <label >Level 5: </label>
                <input id="levelDescription5" type="text"  name="level5.description"/> <br />

                <button id="btSubmit" type="submit" >Save</button> <br />

            </fieldset>
        </form>


        <form name="submitFactors" id="submitFactors" method="post" hidden="true">
            <button id="btSubmit" type="submit" onclick="addFactorsAndLevels();" >Add Levels and Factor</button> <br />
        </form>



    </body>
</html>
